package org.netty.demo.lihh.notice.server;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpObjectAggregator;
import io.netty.handler.codec.http.HttpServerCodec;
import io.netty.handler.stream.ChunkedWriteHandler;


public class MyChannelInitializer extends ChannelInitializer<SocketChannel> {
  @Override
  protected void initChannel(SocketChannel channel) throws Exception {
    channel.pipeline().addLast("http-codec", new HttpServerCodec());
    channel.pipeline().addLast("aggregator", new HttpObjectAggregator(65536));
    channel.pipeline().addLast("http-chunked", new ChunkedWriteHandler());
    
    // 这里添加自己的实现
    channel.pipeline().addLast(new MyServerHandler());
  }
}
